import request from "@/utils/request";
import RequestMethod from "@/constant/RequestMethod";

export function addGoods(data) {
    return request({
        url: '/api/goods',
        method: RequestMethod.POST,
        data
    })
}

export function removeGoods(id) {
    return request({
        url: '/api/goods/' + id,
        method: RequestMethod.DELETE,
    })
}

export function updateGoods(data) {
    return request({
        url: '/api/goods',
        method: RequestMethod.PUT,
        data
    })
}

export function getGoods(condtion) {
    return request({
        url: '/api/goods',
        method: RequestMethod.GET,
        params: condtion
    })
}

export function getRandomGoods() {
    return  request({
        url : '/api/goods/random',
        method: RequestMethod.GET
    })
}

export function getGoodsType(id) {
    return request({
        url: '/api/goodsType/' + id,
        method: RequestMethod.GET
    })
}

export function addGoodsType(data){
    return request({
        url : '/api/goodsType',
        method:RequestMethod.POST,
        data
    })
}